/*
 * Classname PrincipalMetaData.java
 * 
 * Version Information
 * Date Mar 20, 2006
 *
 * Copyright (c) AmSoft Systems, 2006
 */
package net.amsoft.iservice.isso.hibernate;

import net.amsoft.iservice.isso.util.ISSOUtils;
import net.amsoft.iservice.util.exception.IServiceException;

import org.apache.log4j.Logger;

/**
 * @author jyoti
 */

public class PrincipalMetaData extends ISSOObject {
    private static Logger logger = Logger.getLogger(PrincipalMetaData.class);

    private String sEncPasswd;
    private String sEncGreeting;
    private int iChallengeQuestionId;
    private String sEncPwdRecAnswer;
    private String sEncActivationToken;
    private String sFirstName;
    private String sLastName;
    private String sEmail;
    private int iContactReqSent;
    private int iContactCompReceived;
    protected Long id;
    private Principal oPrincipal;

    public PrincipalMetaData() {
    }
    
    public String getEncGreeting() {
        return this.sEncGreeting;
    }
    public void setEncGreeting(String encGreeting) {
        this.sEncGreeting = encGreeting;
    }
    
    public String getEncPasswd() {
        return this.sEncPasswd;
    }
    public void setEncPasswd(String encPasswd) {
        this.sEncPasswd = encPasswd;
    }
    
    public String getEncPwdRecAnswer() {
        return this.sEncPwdRecAnswer;
    }
    public void setEncPwdRecAnswer(String encPwdRecAnswer) {
        this.sEncPwdRecAnswer = encPwdRecAnswer;
    }
    
    public String getFirstName() {
        return this.sFirstName;
    }
    public void setFirstName(String firstName) {
        this.sFirstName = firstName;
    }
    
    public String getLastName() {
        return this.sLastName;
    }
    public void setLastName(String lastName) {
        this.sLastName = lastName;
    }

    public int getChallengeQuestionId() {
        return this.iChallengeQuestionId;
    }
    public void setChallengeQuestionId(int challengeQuestionId) {
        this.iChallengeQuestionId = challengeQuestionId;
    }
    
    public int getContactCompReceived() {
        return this.iContactCompReceived;
    }
    public void setContactCompReceived(int contactCompReceived) {
        this.iContactCompReceived = contactCompReceived;
    }
    
    public int getContactReqSent() {
        return this.iContactReqSent;
    }
    public void setContactReqSent(int contactReqSent) {
        this.iContactReqSent = contactReqSent;
    }
    
    public String getEmail() {
        return this.sEmail;
    }
    /**
     * Sets e-mail address in the object, if it is valid
     * 
     * @param eMailAdd
     *            e-mail address of the principal
     * @throws IServiceException
     *             thrown when the e-mail address does not coform to a valid
     *             e-mail type
     */
    public void setEmail(String eMailAdd) throws IServiceException {

        if ((ISSOUtils.checkEmailAddress(eMailAdd)) != 0) {
            this.sEmail = eMailAdd;
        }

    }
    public String getEncActivationToken() {
        return this.sEncActivationToken;
    }
    public void setEncActivationToken(String encActivationToken) {
        this.sEncActivationToken = encActivationToken;
    }

    public Long getId() {
        return id;
    }

    private void setId(Long id) {
        this.id = id;
    }
    public Principal getPrincipal() {
        return this.oPrincipal;
    }
    public void setPrincipal(Principal principal) {
        this.oPrincipal = principal;
    }

    public void debug(String prefix) {
        logger
                .debug(prefix + " : Prncipal Meta Data  (" + id + ", "
                        + iChallengeQuestionId + ", " + iContactCompReceived
                        + ", " + iContactReqSent + ", " + sEmail + ", "
                        + sEncActivationToken + ", " + sEncGreeting + ", "
                        + sEncPasswd + ", " + sEncPwdRecAnswer + ", "
                        + sFirstName + ", " + sLastName + ")");
    }
}
